home *** CD-ROM | disk | FTP | other *** search
/ Dos/V Magazine 1995 October 15 / CD [VMAG951015].bin / _demo / w95demo / mdialogs.dir / 00061.ls < prev    next >
Encoding:
Text File  |  1995-08-10  |  2.0 KB  |  98 lines

  1. on setSprites default
  2.   global gCurrDialogButtonDM
  3.   set gCurrDialogButtonDM to default
  4.   puppetSprite(2, 1)
  5.   puppetSprite(3, 1)
  6.   if the castNum of sprite 4 <> 0 then
  7.     puppetSprite(4, 1)
  8.   end if
  9. end
  10.  
  11. on keyDown
  12.   global gCurrDialogButtonDM
  13.   if voidp(gCurrDialogButtonDM) then
  14.     set gCurrDialogButtonDM to 2
  15.   end if
  16.   set lastsprite to gCurrDialogButtonDM
  17.   if the key = TAB then
  18.     if the castNum of sprite 4 = 0 then
  19.       set limit to 3
  20.     else
  21.       set limit to 4
  22.     end if
  23.     if not (the shiftDown) then
  24.       if lastsprite < limit then
  25.         set gCurrDialogButtonDM to gCurrDialogButtonDM + 1
  26.       else
  27.         set gCurrDialogButtonDM to 2
  28.       end if
  29.     else
  30.       if lastsprite = 2 then
  31.         set gCurrDialogButtonDM to limit
  32.       else
  33.         set gCurrDialogButtonDM to gCurrDialogButtonDM - 1
  34.       end if
  35.     end if
  36.     set c to the castNum of sprite lastsprite
  37.     set the castNum of sprite lastsprite to c - 1
  38.     set c to the castNum of sprite gCurrDialogButtonDM
  39.     set the castNum of sprite gCurrDialogButtonDM to c + 1
  40.     updateStage()
  41.   else
  42.     if (the key = RETURN) or (the key = ENTER) then
  43.       hiliteButton(lastsprite)
  44.       mouseDown(script the scriptNum of sprite lastsprite)
  45.     end if
  46.   end if
  47. end
  48.  
  49. on dialogButtonChoice c
  50.   global gDialogResult, gDialogCallback
  51.   set gDialogResult to c
  52.   if count(the windowList) > 0 then
  53.     tell the stage
  54.       do(gDialogCallback)
  55.     end tell
  56.   else
  57.     beep()
  58.   end if
  59. end
  60.  
  61. on hiliteButton s
  62.   if voidp(s) then
  63.     if the lastClick < 20 then
  64.       set s to the clickOn
  65.     else
  66.       exit
  67.     end if
  68.   end if
  69.   set h to the locH of sprite s
  70.   set v to the locV of sprite s
  71.   set the locH of sprite s to h + 2
  72.   set the locV of sprite s to v + 2
  73.   updateStage()
  74.   wait()
  75.   set the locH of sprite s to h
  76.   set the locV of sprite s to v
  77.   wait()
  78.   updateStage()
  79. end
  80.  
  81. on dialogwidth
  82.   return the width of sprite 1
  83. end
  84.  
  85. on dialogHeight
  86.   return the height of sprite 1
  87. end
  88.  
  89. on wait t
  90.   if voidp(t) then
  91.     set t to 10
  92.   end if
  93.   startTimer()
  94.   repeat while the timer < t
  95.     nothing()
  96.   end repeat
  97. end
  98.